home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / lib / strchr.c < prev    next >
C/C++ Source or Header  |  1991-11-27  |  2KB  |  53 lines

  1. /*  $Revision: 1.2 $
  2. **
  3. **  This file has been modified to get it to compile more easily
  4. **  on pre-4.4BSD systems.  Rich $alz, June 1991.
  5. */
  6. #define NULL 0
  7. #define STRCHR
  8.  
  9. /*-
  10.  * Copyright (c) 1990 The Regents of the University of California.
  11.  * All rights reserved.
  12.  *
  13.  * Redistribution and use in source and binary forms are permitted provided
  14.  * that: (1) source distributions retain this entire copyright notice and
  15.  * comment, and (2) distributions including binaries display the following
  16.  * acknowledgement:  ``This product includes software developed by the
  17.  * University of California, Berkeley and its contributors'' in the
  18.  * documentation or other materials provided with the distribution and in
  19.  * all advertising materials mentioning features or use of this software.
  20.  * Neither the name of the University nor the names of its contributors may
  21.  * be used to endorse or promote products derived from this software without
  22.  * specific prior written permission.
  23.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  24.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  25.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  26.  */
  27.  
  28. #if 0
  29. #if defined(LIBC_SCCS) && !defined(lint)
  30. static char sccsid[] = "@(#)index.c    5.6 (Berkeley) 6/23/90";
  31. #endif /* LIBC_SCCS and not lint */
  32.  
  33. #include <string.h>
  34. #include <stddef.h>
  35. #endif
  36.  
  37. char *
  38. #ifdef STRCHR
  39. strchr(p, ch)
  40. #else
  41. index(p, ch)
  42. #endif
  43.     register char *p, ch;
  44. {
  45.     for (;; ++p) {
  46.         if (*p == ch)
  47.             return(p);
  48.         if (!*p)
  49.             return((char *)NULL);
  50.     }
  51.     /* NOTREACHED */
  52. }
  53.